package edu.tyut.game.service.impl;

import edu.tyut.game.dao.user.UserDao;
import edu.tyut.game.model.User;
import edu.tyut.game.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class UserServiceImpl implements UserService {

    private UserDao userDao;

    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }


    @Override
    public void register(User user) {
        userDao.insert(user);
    }

    @Override
    public void updatePassword(String username, String password) {
        userDao.update(username, password);
    }

    @Override
    public User getUserByUsername(String username) {
        return userDao.findByUserName(username);
    }


    @Override
    public boolean login(String username, String password) {
        return false;
    }

    @Override
    public int updateHeadIcon(int uid, String path) {
        return userDao.updateHeadIcon(uid, path);
    }

}
